package zad1;

abstract class Workers extends Thread {

	Buffor bufor;
	String nextWorkerId;
	String workId;

	public Workers(String workId) {
		this.workId = workId;
	}

	public void setWorkId(String workId) {
		this.workId = workId;
	}

	public String getWorkId() {
		return workId;
	};

	public Buffor getBufor() {
		return bufor;
	}

	public void setBufor(Buffor bufor) {
		this.bufor = bufor;
	}

	public String next() {
		return nextWorkerId;
	}

	public void setNextWorkerId(String nextWorkerId) {
		this.nextWorkerId = nextWorkerId;
	}

	abstract public String consume(String data);

	@Override
	public void run() {
		int i = 0;

		while (true) {
			bufor.consume(this, i);
			i = bufor.next(i);
		}

	}

}